package com.ssm.controller;

import com.ssm.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by Lenovo on 2019-4-21.
 */
@Controller
@RequestMapping("/Student")
public class StudentController {
    @Autowired
    private StudentService studentServiceImpl;
    @RequestMapping("login.do")
    public String login(String name,String password){
        System.out.println(name);
        if(studentServiceImpl.login(name, password))
            return "redirect:list.do";
        else
            return "index";
    }
@RequestMapping("list.do")
    public String list(){

        return "listStudents";
}
    @RequestMapping(value = "toAdd.do",method = RequestMethod.POST)
    public String toAdd(){
          return "addStudent";
    }
    @RequestMapping(value = "add.do",method = RequestMethod.POST)
    public String add( String username,  String password){
        System.out.println(username);
        System.out.println(password);
        return "listStudents";
    }
}
